package DesignPattern.responsibility;

/**
 * @Author self
 * @Date 2025/7/10 20:22
 * @Describe 责任链模式
 */
// 客户端代码
public class Client {
    public static void main(String[] args) {
        Handler handlerA = new ConcreteHandlerA();
        Handler handlerB = new ConcreteHandlerB();

        handlerA.setNext(handlerB);

        Request request1 = new Request("typeA");
        handlerA.handle(request1); // 输出: ConcreteHandlerA handled the request.

        Request request2 = new Request("typeB");
        handlerA.handle(request2); // 输出: ConcreteHandlerB handled the request.
    }
}
